/*
 * initscan.c (part of p8.c)
 *  
 *
 *  Created by Shang-Ju Chen on 3/5/11.
 *  
 *
 */

void
initscan( void )
{	
	int h,i;
	ch = NEWL;
	line = nerr = nilit = nrlit = nrvar = nsymb = 0;
	hashp = (HASHREC *)malloc(HSIZE*sizeof(HASHREC));
	
	IF(hashp == (HASHREC *)NULL)
	{
		puts("** can't allocate hash table **");
		exit(1);
	}
	
	ssp = (char *) malloc (SSIZE);
	
	IF(ssp == (char *) NULL)
	{
		puts("** can't allocate string space **");
		exit(1);
	}
	
	ssp1 = ssp + SSIZE;
	
	for(i = 0; i < HSIZE ; i++)
	{
		hashp[i].ptss = (char *)NULL;
	}
	
	for(i = 0; i < sizeof(trw) / sizeof(char *); i++)
	{
		h = -(hash(trw[i]) + 1);
		hashp[h].ptss = trw[i];
		hashp[h].icod = 300 + i;
	}
}
